package it.polimi.digitalstate.dto;

import java.util.Date;

public class MembershipDTO implements IDataTransferObject{
	
	private Integer id;
	private CitizenDTO citizen;
	private PartyDTO party;
	private String cv;
	private Date date_of_joining;
	private Date date_of_leaving;
	
	/**
	 * To be called from the WebTier
	 */
	public MembershipDTO(){
		
	}
	/**
	 * To be called from the PersistentTier
	 */
	public MembershipDTO(int id,CitizenDTO citizen,PartyDTO party, String cv,java.sql.Date date_of_joining, java.sql.Date date_of_leaving){
		this.id=new Integer(id);
		this.citizen=citizen;
		this.party=party;
		this.cv=cv;
		this.date_of_joining = new Date(date_of_joining.getTime());
		this.date_of_leaving = (date_of_leaving==null)?null:new Date(date_of_leaving.getTime());
	}
	public MembershipDTO(CitizenDTO citizen,PartyDTO party,java.sql.Date date_of_joining, String cv){
		this.citizen=citizen;
		this.party=party;
		this.cv=cv;
		this.date_of_joining = new Date(date_of_joining.getTime());
	}
	public CitizenDTO getCitizen() {
		return citizen;
	}

	public void setCitizen(CitizenDTO citizen) {
		this.citizen = citizen;
	}

	public String getCv() {
		return cv;
	}

	public void setCv(String cv) {
		this.cv = cv;
	}

	@Override
	public int getID() {
		// TODO Auto-generated method stub
		return id.intValue();
	}
	public PartyDTO getParty() {
		return party;
	}
	public void setParty(PartyDTO party) {
		this.party = party;
	}
	public boolean isCurrent(){
		return this.date_of_leaving!=null;
	}
	public Date getDate_of_joining() {
		return date_of_joining;
	}
	public void setDate_of_joinging(Date date_of_joining) {
		this.date_of_joining = date_of_joining;
	}
	public Date getDate_of_leaving() {
		return date_of_leaving;
	}
	public void setDate_of_leaving(Date date_of_leaving) {
		this.date_of_leaving = date_of_leaving;
	}
}
